import invokeComponent from './invode-component'

class ComponentHolder {
    private map: Map<Function, any> = new Map()
    add(fun: Function) {
        this.map.set(fun, null)
    }
    get(fun: Function) {
        let component = this.map.get(fun)
        if (component === null) {
            component = invokeComponent(fun)
            this.map.set(fun, component)
        }
        return component
    }
}

export default new ComponentHolder()
